home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / dev / gui / gui4cli.lha / Gui4Cli / Tools / Rtn / FindFile < prev    next >
Encoding:
Text File  |  1999-11-24  |  1.2 KB  |  56 lines

  1. G4C
  2.  
  3. ; FindFile FileName
  4.  
  5. ; Ask the user to show us where he has the given file.
  6. ; Returns the filename
  7.  
  8.  
  9. xONLOAD filename
  10.  
  11.     ; quit file here.. This seems weird, but remember that guiquit will just
  12.     ; mark the gui for quiting. The gui will actually quit *after* it has
  13.     ; executed all it's commands..
  14.     guiquit findfile
  15.  
  16.     ; check that we were given a file name
  17.     if $filename = ''
  18.        say '*ERROR: guis:tools/rtn/FindFile requires an argument!'
  19.        stop
  20.     endif
  21.  
  22.     ; check if the file already exists
  23.     ifexists file $filename
  24.        return $findfile/filename    ; always use full variable path
  25.     endif
  26.  
  27.     ; ask for file
  28.     ezreq "$filename was not found..\n\nDo you want to look for it ?" "Browse..|Ignore|CANCEL" choice
  29.  
  30.     if $choice = 0            ; no he don't
  31.        return ""
  32.     elseif $choice = 2        ; ignore
  33.        return "guis:c/comline"
  34.     endif
  35.  
  36.     ; go find the file..
  37.  
  38.     name = ''
  39.     ReqFile  -1 -1 300 200 "Locate $filename:" LOAD name ''   
  40.  
  41.     if $name = ""            ; cancelled
  42.         return ""
  43.     elseifexists file $name
  44.         return $findfile/name       ; success - Return *Full* variable Path!!
  45.     else
  46.         ezreq "File does not exist!\nWhat now.. ?" 'Continue..|CANCEL' choice
  47.         if $choice = 0        ; canceled
  48.             return ""
  49.         else
  50.         return "guis:c/comline" ; oh well..
  51.         endif
  52.     endif
  53.  
  54.  
  55.  
  56.